//
//  DDLoginService.m
//  DingDongZP
//
//  Created by 王威 on 16/3/23.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

#import "DDLoginService.h"

@implementation DDLoginService

- (void)queryLoginWithMobile:(NSString *)mobile
                    passWord:(NSString *)password
                successBlock:(successBlock)successBlock
                   failBlock:(faileBlock)failBlock
{
    NSString *requestUrlString = [[DDAPIGenerate sharedInstance] API:@"login"];
    
    NSMutableDictionary *params = [@{} mutableCopy];
    if (mobile) {
        [params setValue:mobile forKey:@"mobile"];
    }
    if (password) {
        [params setValue:password forKey:@"password"];
    }
    
    [[DDNetWorkManager shareManager]GET:requestUrlString parameters:params success:successBlock failure:failBlock];

}

- (void)quickRegisterWithMobile:(NSString *)mobile
                           Code:(NSString *)code
                   successBlock:(successBlock)successBlock
                      failBlock:(faileBlock)failBlock
{
    
    NSString *requestUrlString = [[DDAPIGenerate sharedInstance] API:@"login_express"];
    
    NSMutableDictionary *params = [@{} mutableCopy];
    if (mobile) {
        [params setValue:mobile forKey:@"mobile"];
    }
    if (code) {
        [params setValue:code forKey:@"code"];///
    }
    
    [[DDNetWorkManager shareManager]POST:requestUrlString parameters:params success:successBlock failure:failBlock];

    
}

- (void)forgetsRegisterWithMobile:(NSString *)mobile
                        password:(NSString *)password
                            code:(NSString *)code
                    successBlock:(successBlock)successBlock
                       failBlock:(faileBlock)failBlock
{
    
    NSString *URLString = [[DDAPIGenerate sharedInstance] API:@"resetpassword"];
    
    NSMutableDictionary *params = [@{} mutableCopy];
    
    if (mobile) {
        [params setValue:mobile forKey:@"mobile"];
    }
    if (password) {
        [params setValue:password forKey:@"password"];
    }
    if (code) {
        [params setValue:code forKey:@"code"];
    }
    
    DDNetWorkManager *manager = [DDNetWorkManager shareManager];
    
    [manager POST:URLString parameters:params success:successBlock failure:failBlock];

    
    
}


@end
